package com.example.text.cyclone



import android.os.Build
import com.example.text.utils.GSON
import com.google.gson.annotations.SerializedName

import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody

/**
 * Created by ZengCS on 2023/3/9.
 * E-mail:zengcs@vip.qq.com
 * Add:中国成都
 * Desc:
 */

open class BaseRequestBody {
    fun toJson(): String {
        return GSON.toJson(this)
    }

    fun toRequestBody(): RequestBody {
        return RequestBody.create("application/json".toMediaType(), this.toJson())
    }
}

/**门店分页参数*/
data class StorePageBody(
    val id: Long = 0L,
    var name: String? = null,
    var provinceCode: String? = null,
    var serviceCode: String? = null,
    var cityCode: String? = null,
    var latitude: String? = null,
    var longitude: String? = null,
    var evaluateMost: Boolean? = null,
    var nearest: Boolean? = null,
    var limit: Int = 10,
    var start: Int = 1,
    //新增物料code
    var codes: List<String>? = null,
) : BaseRequestBody()

/**门店评价分页参数*/
data class StoreEvaluatePageBody(
    var storeId: Long? = null,
    var limit: Int = 10,
    var start: Int = 1,
) : BaseRequestBody()

/**在线报修 - 预约信息*/
data class OnlineFixBody(
    var storeId: Long? = null,
    var id: Long? = null,/*补充在线报修记录Id*/
    var frameNo: String? = null,
    var name: String? = null,
    var phone: String? = null,
    var reservationReason: String? = null,
    var reservationTime: String? = null,
    var files: List<Long>? = null
) : BaseRequestBody()

/**门店评分*/
data class StoreEvaluateBody(
    val content: String? = null,
    val dataId: Long? = null,
    val dataType: String? = null,
    val evaluate: List<Map<String, Int>>? = null, // result to 1
    var files: List<Long>? = null
) : BaseRequestBody()

/**门店评价举报*/
data class StoreEvaluationReportBody(
    val content: String? = null,
    val typeCode: String? = null,
    val typeName: String? = null,
    @SerializedName("userevaluateId")
    val userId: Long? = null,
) : BaseRequestBody()

/**商品评价举报*/
data class GoodsEvaluationReportBody(
    val reportTypeCode: String? = null,
    val reportTypeName: String? = null,
    val evaluateId: Long? = null,
) : BaseRequestBody()

/**预约试驾*/
data class BookingDriverBody(
    var brandCode: String? = null,
    var brandName: String? = null,
    var modelCode: String? = null,
    var modelName: String? = null,
    var name: String? = null,
    var phone: String? = null,
    var reservationTime: String? = null,
    var seriesCode: String? = null,
    var seriesName: String? = null,
    var storeId: Long? = null,
    var verifyCode: String? = null
) : BaseRequestBody()

/**预约试驾车型获取*/
data class TestDriverModelBody(
    val storeId: Long? = null,
    val modelName: String? = null,
    val start: Int = 1,
    val limit: Int = 100
) : BaseRequestBody()

/**预约试驾手机验证码获取*/
data class TestDriverSmsCodeBody(
    val phone: String? = null,
) : BaseRequestBody()

/**一键救援创建*/
data class RescueCreateBody(
    var address: String? = null,
    var frameNo: String? = null,
    var latitude: String? = null,
    var longitude: String? = null,
    var rescueReasonsCode: String? = null,
    var rescueReasonsDetail: String? = null,
    var rescueReasonsName: String? = null,
) : BaseRequestBody()

/**一键救援记录*/
data class RescueQueryBody(
    var start: Int = 1,
    var limit: Int = 10,
    val beginReservationTime: String? = null,
    val brandCode: String? = null,
    val endReservationTime: String? = null,
    val modelCode: String? = null,
    val receiveState: String? = null,
    @SerializedName("rescueOrderno")
    val rescueOrderNo: String? = null,
) : BaseRequestBody()

///**埋点数据*/
//
//data class AnalyticsBody(
//    val actionKey: String? = null,
//    val data: String? = null,
//    val channel: String = "App",
//    val os: String = "Android",
//    val dataSourceCode: String = "sklApp",
//    val channelVersion: String = Build.VERSION.SDK_INT.toString(),
//    val channelInfo: String = Build.BRAND + "_" + Build.MODEL,
//    val appVersion: String = BuildConfig.VERSION_NAME,
//    // val userId: String? = UserMMKV.requiredUserId(),
//    val userName: String? = UserMMKV.requiredUserName(),
//) : BaseRequestBody()

/**埋点数据*/
data class AnalyticsData(
    /**login*/
    val date: String? = null, //日期
    val brand: String? = null, //品牌 手机/商品
    val os: String? = null, //系统
    val num: Int? = null,
    /****pageView*/
    val page: String? = null,
    val lastPage: String? = null, //入口
    val times: String? = null, //浏览时间
    val pageName: String? = null,
    /**goodsBrowse*/
    @SerializedName("product_type")
    val productType: String? = null,    //商品类型	part
    val price: String? = null, //商品价格	1000
    val goodsId: Long? = null,  //	商品id	1111
    val modelCode: String? = null,    //车系编码	123213
    val brandId: String? = null, //商品品牌id	1
    val model: String? = null,//商品型号(车型)名称	zs123
    val title: String? = null,//商品名称	rx3
    /**广告*/
    val adName: String? = null,
    val adAddr: String? = null,
    val adId: String? = null,
    val show: Boolean? = null,
    val acitvityName: String? = null,
    val join: String? = null,
    val loading: String? = null,
    val click: Boolean? = null,
    val type: String? = null,

    )

///**预约数据数据*/
//data class BookingVehicleBody(
//    //品牌
//    val brand: BookingDrivingAttrItem? = null,
//    //车型
//    val model: BookingDrivingAttrItem? = null,
//    //车系
//    val tline: BookingDrivingAttrItem? = null,
//) : BaseRequestBody()
